<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>新增机场服务类型</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/font-awesome.css" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">
    <link rel="stylesheet" href="css/ui.css">
</head>
<body class="gray-bg animated fadeInRight">
    <div class="row wrapper border-bottom white-bg page-heading">
        <div class="col-sm-4">
            <h2>新增机场服务类型</h2>
            <ol class="breadcrumb">
                <li>
                    <a href="basic.html" class="J_menuItem">主页</a>
                </li>
                <li>
                    <a href="serviceList.html" class="J_menuItem">机场服务类型</a>
                </li>
                <li>
                    <strong>新增机场服务类型</strong>
                </li>
            </ol>
        </div>
    </div>
    <div class="wrapper wrapper-content">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                        <div class="form-horizontal">
                            <div class="form-group">
                                <label class="col-sm-2 control-label tl">机场服务名称</label>
                                <div class="col-sm-10">
                                    <input type="text" id="name" class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label tl">机场服务ICON</label>
                                <div class="col-sm-5">
                                    <input type="file" class="form-control" id="iconOld">
                                    <input type="hidden" class="form-control iconOld">
                                </div>
                                <div class="iconOld col-sm-5"></div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label tl">机场服务Banner</label>
                                <div class="col-sm-5">
                                    <input type="file" class="form-control" id="banner">
                                    <input type="hidden" class="form-control banner">
                                </div>
                                <div class="banner col-sm-5"></div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2">
                                    <button id="submit" class="btn btn-info">保存</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- 全局js -->
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <!-- 自定义js -->
    <script src="js/content.js"></script>
    <script src="js/work/common.js"></script>
    <script src="js/compressImg.js"></script>
    <script src="js/plugins/layer/layer.min.js"></script>
    <script>
        $(document).ready(function () {
            //保存
            $("#submit").on("click", function(){
                var name = $("#name").val();
                var icon = $(".iconOld").val();
                var banner = $(".banner").val();
                if(isNULL(name)){
                    layer.msg('请输入名称');
                    return
                }
                if(isNULL(icon)){
                    layer.msg('请上传icon');
                    return
                }
                if(isNULL(banner)){
                    layer.msg('请上传banner');
                    return
                }
                ajax({
                    url: "airportServiceMain/addService",
                    data: {
                        service_name: name,
                        service_web_icon2: icon,
                        service_banner: banner
                    },
                    successx: function (data) {
                        if (data.success == true) {
                            layer.msg('操作成功', {shift: -1,time:1000}, function() {
                                window.location.href="serviceList.html";
                            });
                        } else {
                            alert(data.message)
                        }
                    }
                })
            })
            //上传图片
            var filepath = $("#banner").compress({
                max_size:"1",//最大上传数量
                img_id:"banner",//单张上传图片，根据img id或div id设置src或background-image
                upload_interface:web_url_prefix+"upload/uploadJitesCmsImageMulit",
                el: "banner"
            });
            var filepath = $("#iconOld").compress({
                max_size:"1",//最大上传数量
                img_id:"iconOld",//单张上传图片，根据img id或div id设置src或background-image
                upload_interface:web_url_prefix+"upload/uploadJitesCmsImageMulit",
                el: "iconOld"
            });
        });
    </script>
</body>
</html>
